<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <title>首页</title>
    <base href="<%=basePath%>">
    <%@include file="../top.jsp"%>
    <script type="application/javascript">
        $(function () {
            $("#city").change(function () {
                var cityName = $(this).children('option:selected').text();
                var url = "${path}/hotelAction!searchHotel";
                var data = {
                    "cityName": cityName
                };
                $.post(url, data, function (jsonData) {
                    $("#choose").siblings();
                    for (var i = 0; i < jsonData.length; i++) {
                        var option = "<option value=" + jsonData[i].hotelId + ">" + jsonData[i].hotelName + "</option>";
                        $("#hotel").append(option);
                    }
                }, "json");
            });
            $("#hotel").change(function () {
                var hotelId = $("#hotel").val();
                var url = "hotelAction!searchRoom?hotelId=" + hotelId + "";
                $("#frame").attr("src", url);
            });
        });
    </script>
</head>
<body>
<div style="float:left;width: 25%;margin-top: 30px;margin-left: 5%;">
    <div style="margin-top: 10px;">
        <select id="city">
            <option>===请选择城市===</option>
            <s:iterator value="cityList" var="city">
                <option value='<s:property value="#city.cityName"/>'><s:property value="#city.cityName"/></option>
            </s:iterator>
        </select>
    </div>
    <div style="margin-top: 10px;">
        <select id="hotel" class="form-control">
            <option id="choose" value="">===请选择酒店===</option>
        </select>
    </div>
    <div style="margin-top: 10px;">
        入住日期:<input type="text" id="beginTime" class="sang_Calender"/>
    </div>
    <div style="margin-top: 10px;">
        离店日期:<input type="text" id="endTime" class="sang_Calender"/>
    </div>
</div>

<div style="float: left;width: 70%">
    <iframe id="frame" src="" frameborder="0" style="width: 100%;height: 700px" scrolling="no"></iframe>
</div>
</body>
</html>
